//
//  AeroMapServices.m
//  SDK开发版本
//
//  Created by 北京国泰北斗科技有限公司 on 2016/11/17.
//  Copyright © 2016年 北京国泰北斗科技有限公司. All rights reserved.
//

#import "AeroMapServices.h"
#import <GoogleMaps/GoogleMaps.h>

static NSString * const kUserPermissionURL = @"https://www.u-cloud.cn/u-cloud/api/iossdk";
static NSString * const kAppAK = @"AIzaSyBB-CeityLQJSIvNVSywMorsAVzMmcgz-c";

static NSString *provideAPIResult;
static NSString *AeroMapAK;

@interface AeroMapServices()

@end

@implementation AeroMapServices

- (NSString *)provideAPIResult{
    
    return [provideAPIResult copy];
}

- (NSString *)AeroMapAK{
    return [AeroMapAK copy];
}

+ (BOOL)provideAPIKey:(NSString *)APIKey{
    
    AeroMapAK = APIKey;
    [GMSServices provideAPIKey:kAppAK];
    
    //获取设备信息
    // 获取当前App的基本信息字典
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    //app名称
    NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    // app版本
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    // app build版本
    NSString *app_build = [infoDictionary objectForKey:@"CFBundleVersion"];
    //手机序列号
    NSString* identifierNumber = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    //手机别名： 用户定义的名称
    NSString* userPhoneName = [[UIDevice currentDevice] name];
    //设备名称
    NSString* deviceName = [[UIDevice currentDevice] systemName];
    //手机系统版本
    NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];
    //手机型号
    NSString* phoneModel = [[UIDevice currentDevice] model];
    //地方型号  （国际化区域名称）
    NSString* localPhoneModel = [[UIDevice currentDevice] localizedModel];
    
#ifdef DEBUG
    NSLog(@"\n{\nappName:%@\nappVersion:%@\nappBuild:%@\nmobilIndentifier:%@\nuserPhoneName:%@\ndeviceName:%@\nphoneVersion:%@\nphoneModel:%@\nlocalPhoneModel:%@\n}\n",app_Name,app_Version,app_build,identifierNumber,userPhoneName,deviceName,phoneVersion,phoneModel,localPhoneModel);
#endif
    
    return YES;
}

static AeroMapServices *service = nil;

+ (id<NSObject>)shareServices{
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        service = [AeroMapServices new];
    });
    return service;
}
@end
